﻿Public Class Auto
  Implements IComparable(Of Auto)

  Private m_cilindrata As Integer
  Private m_targa As String

  Public Sub New(ByVal pCilindrata _
        As Integer, ByVal pTarga As String)
    m_cilindrata = pCilindrata
    m_targa = pTarga
  End Sub

  Public Overloads Function CompareTo(ByVal _
       obj As Auto) As Integer Implements _
       IComparable(Of Auto).CompareTo

    If TypeOf obj Is Auto Then
      Dim temp As Auto = CType(obj, Auto)
      Return _
        m_cilindrata.CompareTo(temp.cilindrata)
    End If

    Throw New  _
       ArgumentException(
           "Oggetto di tipo diverso da Auto")
  End Function

  ReadOnly Property cilindrata() As Integer
    Get
      cilindrata = m_cilindrata
      Exit Property
    End Get
  End Property

  ReadOnly Property targa() As String
    Get
      targa = m_targa
      Exit Property
    End Get
  End Property
End Class

